<?php
/**
 * Created by PhpStorm.
 * User: zhangjian37
 * Date: 2016/9/5
 * Time: 17:48
 */

#通过判断版本最否是最大的一个，如果是，就在前端显示最新版本号，如果不是，前端就什么都不显示

$RootDir = $_SERVER['DOCUMENT_ROOT'];
include $RootDir.'/utils/mysql/MysqlUtils.php';

$cur_version = $_POST['cur_version'];
$os_type = $_POST['os_type'];
//$cur_version = '0.0.1';
//$os_type = 'android';
//echo $cur_version.$os_type;
$newest_version = '';

$conn = conn_mysql();

$query = "select max(vs_name) as vs_name from versions where os_type = '$os_type'";
$result = queryRecord($query,$conn);
while ($row=mysql_fetch_array($result, MYSQL_ASSOC)) {
    $newest_version=$row['vs_name'];
    break;
}

if ($newest_version >= $cur_version){
    echo $newest_version;
}else{
    echo "";
}